// src/api/modules/order.js
import request from "../request";

export default {
  getOrderList(params = {}) {
    // 参数处理
    const queryParams = {
      ...params,
      page: params.page || 1,
      size: params.size || 10,
    };

    // 删除空值参数
    Object.keys(queryParams).forEach((key) => {
      if (queryParams[key] === null || queryParams[key] === undefined) {
        delete queryParams[key];
      }
    });

    return request.get("/api/order/listOrders", {
      params: queryParams,
    });
  },
  agreeOrder(orderId) {
    return request.put(`/api/order/agreeOrder/${orderId}`);
  },
};
